Skip to content

[WALLET-63] Remove PAR from browser distribution#13

Merged
frostevent merged 1 commit into
mainfrom
jeremie/wallet-63
Jun 16, 2026
Merged

[WALLET-63] Remove PAR from browser distribution#13
frostevent merged 1 commit into
mainfrom
jeremie/wallet-63

Conversation

@frostevent

Copy link
Copy Markdown
Collaborator

Summary

Pushed Authorization Requests (PAR) require sending the client_secret. This PR removes the ability to make PAR from the browser distribution so the secret can never be exposed front-channel — PAR (and client_secret handling) now lives only in the Node-only client. Verified against the built bundles: no PAR/client_secret/request_uri artifacts in the browser graph.

While reworking initialization, this also right-sizes the public API per export and tightens naming.

Changes

  • PAR is Node-only. Moved pushAuthorizationRequest and client_secret out of the browser-reachable base_client.ts into node_client.ts. The browser's getAuthorizationRequestURL builds only the plain authorize URL.
  • Right-sized init() per export. BrowserInitParams (environment, clientId, callbackUri, responseMode?) vs NodeInitParams (all optional, two roles: verify + request-building). Required request-building fields are validated at call time with clear messages.
  • Named trust root for verification. New TrustRoot = "development" | "production". verify/verifyVPToken require trustRoot explicitly — no derivation from environment. A verify-only server now passes one field instead of four irrelevant ones.
  • camelCase consumer-authored params (clientId, callbackUri, responseMode, loginHint, transactionData), mapped to snake_case at the wire boundary.
  • ProofCredentialV1 exposes idiomatic property accessors (cred.isOver18, get dateOfBirth) instead of zero-arg getter methods.
  • Thrown errors standardized as strings.
  • README updated to match the new API.

Breaking changes

Yes — renamed init/request fields, new init param shapes, verify now requires trustRoot, browser PAR removed, and ProofCredentialV1 accessors are properties. Warrants a minor version bump on release.

Testing

No unit test suite exists in this package and there is no test script, so the gate is:

  • yarn check-all (format, lint, typecheck, publint) — passes.
  • yarn build + browser-graph grep — no jose/@sd-jwt/@owf/node: leaks, and no PAR/client_secret artifacts in the browser bundle.

QA skip.

🤖 Generated with Claude Code

Pushed Authorization Requests require sending the client_secret, so move
PAR (and client_secret handling) out of the browser-reachable base client
into the Node-only client. The browser distribution can no longer make PAR
requests or hold a secret.

Also:
- Right-size init() params per export: BrowserInitParams vs NodeInitParams,
  with request-building fields validated at call time.
- Introduce a named TrustRoot ("development" | "production") for verification;
  verify() requires it explicitly (no derivation from environment).
- camelCase consumer-authored params (clientId, callbackUri, responseMode,
  loginHint, transactionData); map to snake_case at the wire boundary.
- ProofCredentialV1 exposes idiomatic property accessors instead of
  zero-arg getter methods.
- Standardize thrown errors as strings.
- Update README to match the new API.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@frostevent frostevent merged commit 79a0f57 into main Jun 16, 2026
8 checks passed
@frostevent frostevent deleted the jeremie/wallet-63 branch June 16, 2026 09:39
@frostevent frostevent mentioned this pull request Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant